/*
 * Copyright 2013 Glassy Cinema.
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *      http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */
package hu.glassy.web.panel.common;

import org.apache.wicket.Component;
import org.apache.wicket.markup.html.basic.Label;
import org.apache.wicket.model.IModel;

/**
 * Olyan panel, amelynek megjelenik valamilyen címe
 *
 * @author molnar.alexander@sonrisa.hu
 */
public abstract class GlassyPanel<T> extends CustomPanel<T>
{

  private static final long serialVersionUID = 2141158001336569613L;

  /**
   * Konstruktor
   *
   * @param id
   */
  public GlassyPanel(final String id)
  {
    this(id, null);
  }

  /**
   * Konstruktor
   *
   * @param id
   * @param model
   */
  public GlassyPanel(final String id, final IModel<?> model)
  {
    super(id, model);

    IModel<String> titleModel = getTitle();
    add(new Label("title", titleModel).setVisible(titleModel != null));

    add(getContent("content"));
  }

  /**
   * A megjelenítendő cím
   *
   * @return
   */
  public IModel<String> getTitle()
  {
    return null;
  }

  ;

  /**
   * A panel törzse
   *
   * @param componentId
   *
   * @return
   */
  abstract public Component getContent(String componentId);

}
